<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>Electron Desktop</title>
  <script>
    function read() {
      const result = myAPI.read()
      console.log(result)
    }
  </script>
</head>

<body>
  <button onclick="read()">获取剪贴板数据</button>
  <pre>
  win = new BrowserWindow({
    width: 600,
    height: 500,
    webPreferences: {
      preload: path.join(__dirname, '../preload/index.js'),
      sandbox: false, // 如果开启了沙箱模式（默认开启），在 preload 中引用 clipboard 会报错
    },
  })
  </pre>
</body>

</html>